package IssueFuction;

import issue.Issue;
import issue.IssueList;

import java.util.Scanner;

public class ReplyFunctions implements IFunctions{
    @Override
    public void work(IssueList issueList){
        System.out.println("回答问题");
        int currentSize=issueList.getUsedSize();
        for (int i = 0; i < currentSize; i++) {//先显示一遍所有问题
            Issue issue=issueList.getIssues(i);
            System.out.println(issue);
        }
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入您要回答问题的序号：");
        int chose=scanner.nextInt();
        System.out.println("请输入您的答案：");
        String settle=scanner.next();
        Issue tmp=null;//媒介
        for (int i = 0; i < currentSize; i++) {
            if (issueList.getIssues(i).getNumber()==chose){
                tmp=issueList.getIssues(i);//找到对应问题就记录
                break;
            }
        }
        tmp.setSettle(settle);
        System.out.println("回复成功");
    }
}
